#include "LoadingPointsThread.h"


void LoadingPointsThread::setFileName(const QString &fileName)
{
	_fileName = fileName;
}

void LoadingPointsThread::run()  
{
	QPolygonF curvePoints;

	XmlReader* reader = new XmlReader(_fileName);
	StressTiMeasurement* meas = meas = reader->tryParseStressTiMeasurement();

	double xStartCoords = 
	(meas->getEndPosition() - meas->getStartPosition()) / meas->getPoints().size();
	
	for (int i = 0; i < meas->getPoints().size(); ++i)
		curvePoints << QPointF(meas->getStartPosition() + i++ * xStartCoords, 
							meas->getPoints().at(i));
	
	//this->sleep(5);

    emit workResult(curvePoints);
}